-
-
Notifications
You must be signed in to change notification settings - Fork 7
Add comprehensive benchmarks for AiDotNet library #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…tions, and Statistics
…CrossValidation, and Internal Comparisons
…prehensive coverage areas (Interpolation, Wavelets, WindowFunctions, RBF)
…d all 35 optimizers
…arning, LoRA, RAG, and GeneticAlgorithms
…benchmarks, all features covered
…bility, and OutlierRemoval
- FitDetectorsBenchmarks.cs: 20 benchmarks for overfitting/underfitting detection
* Default, CrossValidation, Adaptive, Ensemble detectors
* Residual-based: ResidualAnalysis, ResidualBootstrap, Autocorrelation
* Statistical: InformationCriteria, GaussianProcess, CookDistance, VIF
* Resampling: Bootstrap, Jackknife, TimeSeriesCrossValidation
* Feature analysis: FeatureImportance, PartialDependencePlot, ShapleyValue, LearningCurve
* Classification: ROCCurve, PrecisionRecallCurve
- FitnessCalculatorsBenchmarks.cs: 27 benchmarks for model evaluation
* Error-based: MSE, RMSE, MAE, Huber, ModifiedHuber, LogCosh, Quantile
* R-squared: RSquared, AdjustedRSquared
* Classification: CrossEntropy, BinaryCrossEntropy, CategoricalCrossEntropy,
WeightedCrossEntropy, Hinge, SquaredHinge, Focal
* Specialized: KL-Divergence, ElasticNet, Poisson, Exponential, OrdinalRegression
* Similarity: Jaccard, Dice, CosineSimilarity, Contrastive, Triplet
- InterpretabilityBenchmarks.cs: 16 benchmarks for model explainability
* Fairness evaluators: Basic, Group, Comprehensive
* Bias detectors: DemographicParity, DisparateImpact, EqualOpportunity
* Explanation structures: LIME, Anchor, Counterfactual
* Helper metrics: UniqueGroups, GroupIndices, PositiveRate, TPR, FPR, Precision
- OutlierRemovalBenchmarks.cs: 16 benchmarks for outlier detection
* Algorithms: None, ZScore, IQR, MAD, Threshold
* Both Matrix and Tensor support
* Different threshold configurations (strict/lenient)
- CachingBenchmarks.cs: 12 benchmarks for caching performance * ModelCache operations: CacheStepData, GetCachedStepData, ClearCache, GenerateCacheKey * GradientCache operations: CacheGradient, GetCachedGradient, ClearCache * DeterministicCacheKeyGenerator: GenerateKey with/without parameters, CreateInputDataDescriptor * Cache hit/miss patterns for both ModelCache and GradientCache * Tests concurrent access patterns and key generation performance - SerializationBenchmarks.cs: 17 benchmarks for JSON serialization * Matrix serialization: Serialize, Deserialize, RoundTrip * Vector serialization: Serialize, Deserialize, RoundTrip * Tensor 2D serialization: Serialize, Deserialize, RoundTrip * Tensor 3D serialization: Serialize, Deserialize, RoundTrip * JsonConverterRegistry: RegisterCustomConverters * Multiple objects: Serialize and deserialize multiple objects at once * Float vs Double: Performance comparison for different numeric types
- TransferLearningBenchmarks.cs: 16 benchmarks for transfer learning
* Domain Adaptation: CORAL, MMD (with RBF, Linear, Polynomial kernels)
* Feature Mapping: LinearFeatureMapper (Fit, Transform, FitTransform)
* Transfer Algorithms: TransferNeuralNetwork and TransferRandomForest
- Training, fine-tuning, and prediction benchmarks
* End-to-End Scenarios: CORAL+NN, MMD+RF, LinearMapping+NN pipelines
- BENCHMARK_SUMMARY.md: Updated with complete statistics
* Total: 39 files, 607 benchmarks (up from 32 files, 483 benchmarks)
* Coverage: 53+ feature areas (up from 47+)
* New sections added for all 7 new benchmark categories
* Updated performance comparison matrix
* Added "Latest Additions" section documenting all new benchmarks
* Updated benchmark execution examples
New Feature Areas Covered:
31. FitDetectors (20 types) - Overfitting/underfitting detection
32. FitnessCalculators (26+ types) - Model evaluation metrics
33. Interpretability - Fairness, bias detection, explainability
34. OutlierRemoval (5 algorithms) - Data cleaning
35. Caching - ModelCache, GradientCache, key generation
36. Serialization - Matrix, Vector, Tensor JSON performance
37. TransferLearning - Domain adaptation, feature mapping, algorithms
Status: 100% benchmark coverage achieved across all 53+ feature areas
|
Warning Rate limit exceeded@ooples has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 11 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (41)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a comprehensive benchmark suite for the AiDotNet library, providing extensive performance testing infrastructure. The benchmarks cover 53+ feature areas with 607 benchmark methods across 39 files, enabling performance monitoring, regression detection, and competitive analysis against Accord.NET, ML.NET, and TensorFlow.NET.
Key Changes:
- Added BenchmarkSwitcher to Program.cs for flexible benchmark execution with command-line filtering
- Implemented 39 benchmark files covering all major AiDotNet features (LinearAlgebra, Statistics, Regression, Neural Networks, Optimizers, Activation Functions, Loss Functions, etc.)
- Added competitor library dependencies (Accord.NET, ML.NET, TensorFlow.NET) for comparative benchmarking
- Created comprehensive documentation in BENCHMARK_SUMMARY.md detailing all 607 benchmarks
Reviewed Changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 17 comments.
| File | Description |
|---|---|
| Program.cs | Updated to use BenchmarkSwitcher for command-line benchmark selection |
| AiDotNetBenchmarkTests.csproj | Added competitor library dependencies for benchmarking comparisons |
| BENCHMARK_SUMMARY.md | Comprehensive documentation of all 607 benchmarks across 53+ feature areas |
| VectorOperationsBenchmarks.cs (and 38 other benchmark files) | New benchmark implementations covering all major library features |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| foreach (var doc in retrievedDocs) | ||
| { | ||
| if (relevantDocs.Contains(doc)) | ||
| { | ||
| correct++; | ||
| } | ||
| } |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This foreach loop implicitly filters its target sequence - consider filtering the sequence explicitly using '.Where(...)'.
| { | ||
| x[i] = _aiTrainX[i, 0]; | ||
| } | ||
| model.Regress(x, _accordTrainY); |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to obsolete method Regress.
| public MultipleLinearRegression AccordNet_MultipleRegression_Train() | ||
| { | ||
| var model = new MultipleLinearRegression(); | ||
| model.Regress(_accordTrainX, _accordTrainY); |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to obsolete method Regress.
| public double[] AccordNet_MultipleRegression_Predict() | ||
| { | ||
| var model = new MultipleLinearRegression(); | ||
| model.Regress(_accordTrainX, _accordTrainY); |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to obsolete method Regress.
| x[i] = _aiTrainX[i, 0]; | ||
| } | ||
| var model = new PolynomialRegression(degree: 2); | ||
| model.Regress(x, _accordTrainY); |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to obsolete method Regress.
| [GlobalSetup] | ||
| public void Setup() | ||
| { | ||
| var random = new Random(42); |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment to random is useless, since its value is never read.
| if (random.NextDouble() < 0.1) | ||
| { | ||
| _dataWithMissing[i, j] = double.NaN; | ||
| } | ||
| else | ||
| { | ||
| _dataWithMissing[i, j] = value; | ||
| } |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.
| if (random.NextDouble() < 0.1) | |
| { | |
| _dataWithMissing[i, j] = double.NaN; | |
| } | |
| else | |
| { | |
| _dataWithMissing[i, j] = value; | |
| } | |
| _dataWithMissing[i, j] = (random.NextDouble() < 0.1) ? double.NaN : value; |
| if (random.NextDouble() < 0.05) | ||
| { | ||
| _dataWithOutliers[i, j] = value * 10; // Extreme outlier | ||
| } | ||
| else | ||
| { | ||
| _dataWithOutliers[i, j] = value; | ||
| } |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.
| if (random.NextDouble() < 0.05) | |
| { | |
| _dataWithOutliers[i, j] = value * 10; // Extreme outlier | |
| } | |
| else | |
| { | |
| _dataWithOutliers[i, j] = value; | |
| } | |
| _dataWithOutliers[i, j] = (random.NextDouble() < 0.05) ? value * 10 : value; // Extreme outlier |
| if (random.NextDouble() < 0.05) // 5% outliers | ||
| { | ||
| _inputs[i, j] = random.NextDouble() * 100; // Large outlier | ||
| } | ||
| else | ||
| { | ||
| _inputs[i, j] = random.NextDouble() * 2 - 1; // Normal data | ||
| } | ||
| } | ||
|
|
||
| if (random.NextDouble() < 0.05) // 5% output outliers | ||
| { | ||
| _outputs[i] = random.NextDouble() * 100; | ||
| } | ||
| else | ||
| { | ||
| _outputs[i] = random.NextDouble() * 10; | ||
| } |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.
| if (random.NextDouble() < 0.05) // 5% outliers | |
| { | |
| _inputs[i, j] = random.NextDouble() * 100; // Large outlier | |
| } | |
| else | |
| { | |
| _inputs[i, j] = random.NextDouble() * 2 - 1; // Normal data | |
| } | |
| } | |
| if (random.NextDouble() < 0.05) // 5% output outliers | |
| { | |
| _outputs[i] = random.NextDouble() * 100; | |
| } | |
| else | |
| { | |
| _outputs[i] = random.NextDouble() * 10; | |
| } | |
| _inputs[i, j] = (random.NextDouble() < 0.05) | |
| ? random.NextDouble() * 100 // Large outlier | |
| : random.NextDouble() * 2 - 1; // Normal data | |
| } | |
| _outputs[i] = (random.NextDouble() < 0.05) | |
| ? random.NextDouble() * 100 | |
| : random.NextDouble() * 10; |
| if (random.NextDouble() < 0.05) // 5% output outliers | ||
| { | ||
| _outputs[i] = random.NextDouble() * 100; | ||
| } | ||
| else | ||
| { | ||
| _outputs[i] = random.NextDouble() * 10; | ||
| } |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.
| if (random.NextDouble() < 0.05) // 5% output outliers | |
| { | |
| _outputs[i] = random.NextDouble() * 100; | |
| } | |
| else | |
| { | |
| _outputs[i] = random.NextDouble() * 10; | |
| } | |
| // 5% output outliers | |
| _outputs[i] = (random.NextDouble() < 0.05) | |
| ? random.NextDouble() * 100 | |
| : random.NextDouble() * 10; |
User Story / Context
merge-dev2-to-masterSummary
Verification
Copilot Review Loop (Outcome-Based)
Record counts before/after your last push:
Files Modified
Notes